<?php
/**
 *  💡 免责声明：本软件不得用于商业用途，仅做学习交流
 *  ⚠️ 权利声明：本软件由版权人提供产品技术支持
 *  📅 项目编号：NX2025-0135
 */
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateRechargeRecordsTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up()
    {
        Schema::create('recharge_records', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('user_id')->comment('用户id');
            $table->tinyInteger('payment_method')->default(1)->comment('1-支付宝, 2-微信, 3-银行卡');
            $table->decimal('amount', 18, 2)->default(0)->comment('金额');
            $table->decimal('amount_received', 18, 2)->default(0)->comment('到账数');
            $table->tinyInteger('status')->default(1)->comment('1-处理中, 2-成功, 3-失败');
            $table->tinyInteger('type')->default(1)->comment('1-钱包, 2-积分, 3-KC通证');
            $table->string('voucher')->comment('凭证');
            $table->timestamps();
        });
        \Illuminate\Support\Facades\DB::statement("ALTER TABLE `recharge_records` comment '充值记录表'");
    }

    /**
     * Reverse the migrations.
     */
    public function down()
    {
        Schema::dropIfExists('recharge_records');
    }
}
